package com.neusoft.elm.util;

import com.neusoft.elm.po.Business;
import com.neusoft.elm.service.impl.BusinessServiceImpl;
import java.util.List;
import java.util.ArrayList;

public class MockDataTest {
    public static void main(String[] args) {
        System.out.println("Testing mock data generation...");
        
        // 创建模拟数据
        List<Business> mockBusinesses = createMockBusinesses();
        
        System.out.println("Mock businesses created: " + mockBusinesses.size());
        for (Business business : mockBusinesses) {
            System.out.println("Business: " + business.getBusinessName() + 
                             ", Rating: " + business.getStarPrice() + 
                             ", Distance: " + business.getDeliveryPrice());
        }
        
        // 测试排序
        testSorting(mockBusinesses);
    }
    
    private static List<Business> createMockBusinesses() {
        List<Business> businesses = new ArrayList<>();
        
        Business b1 = new Business();
        b1.setBusinessId(1);
        b1.setBusinessName("半亩良田排骨米饭");
        b1.setStarPrice(4.7);
        b1.setDeliveryPrice(4.2);
        businesses.add(b1);
        
        Business b2 = new Business();
        b2.setBusinessId(2);
        b2.setBusinessName("麦当劳乐送(全运路店)");
        b2.setStarPrice(4.6);
        b2.setDeliveryPrice(1.8);
        businesses.add(b2);
        
        Business b3 = new Business();
        b3.setBusinessId(3);
        b3.setBusinessName("万家饺子(软件园E18店)");
        b3.setStarPrice(4.5);
        b3.setDeliveryPrice(1.2);
        businesses.add(b3);
        
        Business b4 = new Business();
        b4.setBusinessId(4);
        b4.setBusinessName("串记串道(中海康城店)");
        b4.setStarPrice(4.4);
        b4.setDeliveryPrice(2.7);
        businesses.add(b4);
        
        return businesses;
    }
    
    private static void testSorting(List<Business> businesses) {
        System.out.println("\n=== Testing Rating Sort ===");
        List<Business> ratingSort = new ArrayList<>(businesses);
        ratingSort.sort((a, b) -> Double.compare(b.getStarPrice(), a.getStarPrice()));
        for (Business b : ratingSort) {
            System.out.println(b.getBusinessName() + " - Rating: " + b.getStarPrice());
        }
        
        System.out.println("\n=== Testing Distance Sort ===");
        List<Business> distanceSort = new ArrayList<>(businesses);
        distanceSort.sort((a, b) -> Double.compare(a.getDeliveryPrice(), b.getDeliveryPrice()));
        for (Business b : distanceSort) {
            System.out.println(b.getBusinessName() + " - Distance: " + b.getDeliveryPrice());
        }
    }
}